﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="notification_modal_content.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Notification.notification_modal_content" %>
<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <% string userID = Session["Admin_ID"].ToString();
        int notificationID = Convert.ToInt32(Request.QueryString["notificationID"]);

        var notificationColl = new TblNotificationController().FetchAll();
        TblNotification notification = notificationColl.Single(x => x.NotificationId == Convert.ToInt32(notificationID));

        var senderColl = new TblManagerController().FetchAll();
        TblManager sender = senderColl.Single(x => x.ManagerId == notification.NotificationSender);

        if (notification.NotificationSeen == null)
            notification.NotificationSeen = "0";
        if(!notification.NotificationSeen.Contains(userID))
            new TblNotificationController().Update(notification.NotificationId,notification.NotificationSender,notification.NotificationTitle,notification.NotificationContent,notification.NotificationReceiver,notification.NotificationSeen+","+userID,notification.NotificationDate,notification.NotificationIsDelete);
        %>
    <header class="w3-padding w3-teal w3-center">
                    <p style="font-size: 20px;padding-left:10px;margin-bottom:0px;">Thông báo</p>

                    <p style="font-size: 12px"><%= notification.NotificationTitle %></p>
                    <p class="w3-small w3-left"><%= sender.FullName %> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                    <p class="w3-tiny w3-left"><%= notification.NotificationDate %></p>
                    <br />
                </header>
                <div class="w3-row w3-padding w3-text-black">
                    <div class="w3-row w3-padding">
                        <%= notification.NotificationContent %>
                    </div>
                </div>
</body>
</html>
